<template>
  <div class="father">
    <h1>我是父组件</h1>
    <h2>座驾:{{car.name}}-价格:{{car.price}}</h2>
    <son></son>
  </div>
</template>

<script>
import son from "@/components/son.vue";
import {provide} from "vue";
export default {
  name: 'App',
  components:{
    son
  },
  setup() {
    let car ={
      name:'奔驰',
      price:'50w'
    }
    //给后代提供数据
    provide('car',car);
    return {
      car
    }
  }
}
</script>

<style>
  .father{
    background-color: forestgreen;
  }
</style>
